gsk/vulkan/glyphcache: Rework glyphs
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Sat, 8 Apr 2023 22:52:48 +0000 (19:52 -0300)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Sat, 8 Apr 2023 23:13:13 +0000 (20:13 -0300)
commit496c8f4a116aa05f95df32355843cce032921d56
tree6b4031b25aaa290870e455d6c4abc51c6b958d4d
parent8b6f69946c5d3c2e91fb26efb3cf389a588944fc
gsk/vulkan/glyphcache: Rework glyphs

The current implementation of the glyph cache deals with atlases by
padding them with 1 pixel at the beginning, at the end, and between
each glyph.

That's cool and all, however, there's a very subtle problem with
this approach: the contents of the atlas are garbage, so this padding
is filled with garbage memory!

Rework the Vulkan glyph cache to draw each and every glyph in a
surface that has 1 pixel border of padding around it. Ensure the
surface is completely black by drawing a rectangle before handing
it to Pango to draw the glyph. Update tx and ty to pick the texture
position adjusted to the 1 pixel padding. The atlas now starts at
position (0, 0), since each glyph individually contains its own padding.

To improve legibility, add a PADDING define and use it everywhere.
gsk/vulkan/gskvulkanglyphcache.c
gsk/vulkan/gskvulkanrendererprivate.h